{extend name="$admin_layout" /}
{block name="style"}
<style>
.goods-title,.address-txt{
    width:100%;
    max-width:200px;
    white-space: normal;
    line-height:17px;
    word-break:break-all;
    font-size:11px;
}
.ft11{font-size:11px}

</style>
{/block}
{block name="content"}

<script src="__PLUG__/layer/laydate/laydate.js?v={:config('asset_version')}"></script>
<div class="row">
    <div class="col-md-12">
		<div class="box nav-tabs-custom" >
			<div class="box-body">
				<div class="tab-pane active">
					<div class="row">
						<form action="" method="get" class="marBtm" id="order_manage_from">
                            <input type="hidden" value="" name="export" />
							<div class="col-md-2 col-xs-6">
								<span class="txt">订单类型：</span>
								<select name="order_type" class="select2">
									<option value="">全部订单</option>
									<?php foreach($order_typeArr as $k=>$v):?>
										<?php if($order_type == $k):?>
										<option selected value="{$k}">{$v['name']}</option>
										<?php else:?>
										<option value="{$k}">{$v['name']}</option>
										<?php endif;?>
									<?php endforeach;?>
								</select>
							</div>
							<div class="col-md-2 col-xs-6">
								<span class="txt">订单号：</span>
								<input type="text" class="form-control" name="order_sn" placeholder="请输入订单号" value="{$Think.get.order_sn}">
							</div>
							<div class="col-md-2 col-xs-6">
								<span class="txt">用户名：</span>
								<input type="text" class="form-control" name="nickname" placeholder="请输入用户名" value="{$Think.get.nickname}">
							</div>
							<div class="col-md-2 col-xs-6">
								<span class="txt">订单状态：</span>
								<select name="order_status" class="select2">
									<option {if condition="$order_status eq ''"}selected{/if} value="">选择订单状态</option>
									{volist name="order_status_list" id="vo"}
									<option {if condition='$order_status eq "$key"'}selected{/if} value="{$key}">{$vo}</option>
									{/volist}
								</select>
							</div>
							<div class="col-md-2 col-xs-6">
								<span class="txt">下单时间 ：</span>
								<input type="text" class="form-control js-date-range" name="create_time" placeholder="请选择下单时间" value="{$Think.get.create_time}">
							</div>
							<div class="col-md-2 col-xs-6" style="padding-top: 18px;">
								<button class="btn btn-primary btn-flat" onclick="btn_out_search()" type="button">搜索</button> 
								<button class="btn btn-danger btn-flat" type="button" onclick="clearinput()">重置</button>
								<button class="btn btn-success btn-flat" onclick="btn_out()" type="button">导出</button>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
        <div class="nav-tabs-custom">	    
            <div class="box-body">
                <div class="tab-pane active">
                    <div class="pb10">         
                  
                        <a title="{:lang('批量生成发货单')}" href="{:url('express/create_express_all')}"  class="btn btn-sm mr5 btn-default btn-flat js-get confirm" target-form="ids">{:lang('批量生成发货单')}</a>
                        <a title="{:lang('导入EXCEL')}" href="{:url('order/do_edit_import')}" class="btn btn-sm mr5 btn-primary btn-flat"><i class="fa fa-fw fa-file-excel-o"></i> {:lang('导入EXCEL')}</a>
                    </div>
					<div class="table-responsive">
                    <table class="table table-builder table-hover table-bordered table-striped mb10">
                        <thead>   
                            <th class="text-center" width="24px">
                                <input class="minimal-red checkboxCtrl" data-group="ids[]" data-toggle="icheck" type="checkbox">
                            </th>
                            <th class="text-left">商品</th>	
							<th class="text-center">运费</th>							
						    <th class="text-center">订单总价</th>													 
							<th class="text-center">优惠金额</th>
                       												
						    <th class="text-center">应付款</th>
						    <th class="text-left">下单人</th>    
						    <th class="text-left">收件人</th> 
							<th class="text-center" width="50px">订单类型</th>							
                            <th class="text-center" width="50px">支付类型</th>
                            <th class="text-center" width="50px">订单状态</th>                      
                            <th class="text-center">操作</th>
                        </thead>
                        <tbody class="order-table">
                            {volist name="list" id="o"}
                            <tr>            
                                <td class="text-center" width="24px">                        
                                       <div  style="background-color: white;display: inline-block">
                                           <input  class="ids minimal-red" data-toggle="icheck"  type="checkbox" name="ids[]" value="{$o.aid}">
                                       </div>
								 </td>                            
                           
                                <td class="text-left" width="420px"> 								   
																	
									<label  style="vertical-align:middle;font-weight:bold;font-size:11px">								
										订单号：
										<span style="color:#00c0ef">{$o.order_sn}</span>								
									</label>
									<table class="table table-striped table-bordered" style="vertical-align:top">

									{volist name="$o.order_goods_list" id="goods"}
										<tr>
											<td width="40px"><img src="{$goods.goods_thumb|get_thumb}" width="40px" /></td>
											<td style="vertical-align:top">
												<div class="goods-title">
												{$goods.goods_name}
												{eq name="$goods.order_status" value="5"}<label class="label label-danger">退款中</label>{/eq}
												{eq name="$goods.order_status" value="6"}<label class="label label-info">已退款￥{$goods.refund_money}</label>{/eq}											
												</div>											
											    <div class="text-muted" style="color:#999">{$goods.sku_name}</div>											
											</td>	
											<td width="40px" class="ft11">￥{$goods.shop_price}</td>											
											<td width="40px">x {$goods.num}</td>
										</tr>										
									{/volist}	
								   </table>		
								   <div>下单时间：<span class="text-muted" style="color:#999">{$o.create_time}</span></div>								   
                                </td>
								<td class="text-center" >
									+￥{$o.express_price}
							    </td>    
								 	
								<td class="text-center" >
									= ￥{$o.order_money}
							    </td>
							
								<td class="text-center" >
									<div>- ￥{$o.coupon_money} <span class="label label-info">优惠券</span></div> 	
                                    <div class="mt10">{$o.edit_money >=0 ? "+"  : ""} ￥{$o.edit_money}  <span class="label label-danger">改价</span></div> 
									
							    </td> 	
						
								
								<td class="text-center" >
									= ￥{$o.payable_money}
							    </td> 
                                <td class="text-left">
								    <img src="{$o.head_img|get_thumb}" height="40px" /> {$o.user_nickname}
								</td>				
                                <td class="text-left" width="200px">
                                    <div class="address-txt">
								    <div><span class="text-info">{$o.receiver_name}</span> <span class="text-danger">{$o.receiver_mobile}</span></div>
                                   
								   <div style="color:#999">{$o.province} {$o.city} {$o.district} {$o.receiver_address}</div>
                                   </div>
								</td>	
								<td class="text-center">
                                    <span class="label label-flat label-info">{$o.order_type_name}</span>                                   
                                </td>                             
                                <td class="text-center">
                                {if condition="$o['status'] > 0"}							
									<span class="label label-flat label-success"> {$o.pay_type_name} </span>
                                {/if}
                                </td>
                                <td class="text-center">
                                    <span class="label label-flat {if condition='$o.status==0 or $o.status==-1'}label-warning{else/}label-success{/if}">{$o.status_name}</span>
                                </td>                                
                                <td class="text-center font12" style="overflow:visible">
								<!--
								  <a ident="download" title="打印" href="{:url('download',['order_sn'=>$o['order_sn']])}" class="mr5">打印</a>
                                &nbsp;|&nbsp;
								-->
                                    <a ident="edit" title="详情" href="{:url('detail',['order_sn'=>$o['order_sn']])}" class="mr5">详情</a>
                                    {if condition="$o.status == 1"}
										 {gt name="$o.refund_count" value="0"}
										  <a ident="shipping" title="发货" href="javascript:;" class="mr5 disabled">发货</a>
										  {else /}
										   <div ident="shipping" title="发货" class="mr5 dropdown" style="display:inline-block;" >
                                               <a href="javascript:;" data-toggle="dropdown" >发货</a>                                           
                                               <ul class="dropdown-menu dropdown-menu-right" style="min-width:100px">
                                                 <li style="width:100px"><a  href="{:url('express/express_add',['order_sn'=>$o.order_sn])}" >直接发货</a></li>     
                                                 <li style="width:100px"><a href="{:url('express/create_express',['order_sn'=>$o.order_sn])}" >生成发货单</a></li>                                                 
                                              </ul>                                           
                                           </div>                                       
										  {/gt}
                                    {/if}
									{gt name="$o.refund_count" value="0"}
									  <a href="{:url('refund/refund',['order_sn'=>$o['order_sn'],'status'=>'all'])}" style="color:red">{$o.refund_count}笔退款待处理</a>									  
									{/gt}
                          
                                <!---<a ident="delete" title="删除" icon="fa fa-times pr5" class="btn btn-xs mr5 btn-default btn-flat ajax-get confirm"><i class="fa fa-times pr5"></i>删除</a>-->
                                </td>

                            </tr>
                            {/volist}
                        </tbody>
                    </table>
					</div>
                    <div class="data-table-toolbar">
                        <div class="row">
                            {$pages|raw}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="script"}
<script>
//点击导出
function btn_out(){
    $("input[name='export']").val('1');
    $("#order_manage_from").submit();
    return false;
}

//点击搜索
function btn_out_search(){
    $("input[name='export']").val('0');
    $("#order_manage_from").submit();
    return false;
}
function clearinput(){
    $(".marBtm").find('input').val('');
    $(".marBtm").find(".select2").val('').trigger('change');
}
</script>
{/block}

